package com.ky.pro.java.rpc.hd.rmb.service.impl;

import com.ky.pro.java.rpc.hd.common.api.RmbService;
import com.ky.pro.java.rpc.hd.common.constants.CurrencyType;
import com.ky.pro.java.rpc.hd.common.service.impl.ExchangeBaseServiceImpl;
import com.ky.pro.java.rpc.hd.common.web.ResultBean;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName DollarServiceImpl
 * @Description TODO
 * @Date 2022/1/2 21:21
 * @Author kevin
 **/
@DubboService(version = "1.0.0")
@Service
public class RmbServiceImpl implements RmbService {

    @Autowired
    ExchangeBaseServiceImpl exchangeBaseService;

    @Override
    public ResultBean<Boolean> freezeAssets(long accountId, long amount) {
        return exchangeBaseService.freezeAssets(accountId, CurrencyType.CURRENCY_TYPE_RMB, amount);
    }

    @Override
    public ResultBean<Boolean> exchangeToDollar(long accountId, long amount) {
        return exchangeBaseService.exchange(accountId, amount, CurrencyType.CURRENCY_TYPE_RMB, CurrencyType.CURRENCY_TYPE_DOLLAR, 1/7.0);

    }

}
